package cn.touna.jss.common.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 车鉴定错误信息枚举类
 * Created by wuwc on 2018/1/30.
 */
public enum CarIndentifyEnum {

    CarIdentify_ANTHORIZED_FAIL("-1", "用户未授权"),
    CarIdentify_OTHER_FAIL("0", "其他错误"),
    CarIdentify_NOTDATA_FAIL("1", "没有数据"),
    CarIdentify_SIGN_FAIL("2", "签名错误"),
    CarIdentify_ORDERNO_MATCH_FAIL("3", "用户订单号不匹配"),
    CarIdentify_REPORT_QUERY_SUCC("5", "报告查询成功"),
    CarIdentify_ORDER_NOTEXSITS("6", "订单不存在");


    private String errorCode;

    private String errorDesc;

    CarIndentifyEnum(String errorCode, String errorDesc) {
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
    }

    public static String getErrorDescByCode(String errorCode) {
        for (CarIndentifyEnum carIndentify : CarIndentifyEnum.values()) {
            if (StringUtils.equals(errorCode, carIndentify.getErrorCode())) {
                return carIndentify.getErrorDesc();
            }
        }
        return null;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorDesc() {
        return errorDesc;
    }

    public void setErrorDesc(String errorDesc) {
        this.errorDesc = errorDesc;
    }

    public static void main(String[] args) {
        System.out.println(getErrorDescByCode("1"));
    }
}
